<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<title>消息管理</title>
<%@ include file="/page/include.jsp"%>

<script type="text/javascript" charset="utf-8" src="${rootPath }/statics/js/jquery-ui.js"></script>
<!--建议手动加载语言，避免在ie下有时因为加载语言失败导致编辑器加载失败-->
<!--这里加载的语言文件会覆盖你在配置项目里添加的语言类型，比如你在配置项目里配置的是英文，这里加载的中文，那最后就是中文-->
<script type="text/javascript" charset="utf-8" src="<%=basePath%>/statics/plugins/ueditor/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="<%=basePath%>/statics/plugins/ueditor/ueditor.all.min.js"></script>
<script type="text/javascript" charset="utf-8" src="${rootPath }/statics/plugins/ueditor/lang/zh-cn/zh-cn.js"></script>
</head>
<style type="text/css">
.error {
	color: red;
	padding-left: 10px;
}
</style>
<body class="nav-md" style="background-color: #f7f7f7">
	<div class="container body">
		<div class="main_container">
			<div class="framebody" style="min-height: 100%;" role="main">
				<div class="row">
					<div class="col-md-12 col-sm-12 col-xs-12">
						<div class="x_panel">
							<div class="x_content">
								<form class="form-horizontal form-label-left" id="messageForm" name="messageForm" method="post" action="${pageContext.request.contextPath}/message/saveMessage">
									<input type="hidden" id="id" name="id" value="${message.id }">
									<div class="item form-group">
										<label class="control-label col-md-2 col-sm-2 col-xs-2" for="title">标题： <span class="required"><font color="red">*</font></span>
										</label>
										<div class="col-md-6 col-sm-6 col-xs-6">
											<input id="title" name="title" value="${message.title }" class="form-control col-md-3 col-xs-12" type="text">
										</div>
									</div>
									<div class="item form-group">
										<label class="control-label col-md-2 col-sm-2 col-xs-2" for="messageType">消息类型： <span class="required"><font color="red">*</font></span>
										</label>
										<div class="col-md-6 col-sm-6 col-xs-6">
											<select class="form-control col-md-12" id="messageType" name="messageType">
												<option value="">全部</option>
												<option value="1" <c:if test="${message.messageType == 1 }">selected="selected"</c:if>>系统通知</option>
												<option value="3" <c:if test="${message.messageType == 3 }">selected="selected"</c:if>>业界动态</option>
											</select>
										</div>
									</div>
									<div class="item form-group">
										<label class="control-label col-md-2 col-sm-2 col-xs-2" for="imagePath">图片信息： <span class="required"><font color="red">*</font></span>
										</label>
										<div class="col-md-6 col-sm-6 col-xs-6">
											<div class="uploadpic_part">
												<ul id="image_container">
													<c:if test="${ not empty message.imagePath }">
														<li class="removeLi">
															<div class="pic1">
																<img rel="messageImg" src="<%=PublicConfig.IMG_ROOT_URL%>${message.imagePath }" /> <a id="btn_close"
																	href="javascript:$('.removeLi').remove();$('#imagePath').val('');" class="icon_close"></a>
															</div>
														</li>
													</c:if>
													<li>
														<div class="pic1">
															<img src="${rootPath}/statics/images/upload_pic1.png" /> <input id="upload_tag_image" name="upload_tag_image" type="file"
																onchange="ajaxFileUpload(this);" />
														</div>
													</li>
												</ul>
											</div>
											<span class="pictips">建议尺寸450像素 * 300像素</span> 
											<input id="imagePath" name="imagePath" value="${message.imagePath }" type="hidden">
										</div>
									</div>
									<div class="item form-group">
										<label class="control-label col-md-2" for="name">图文描述：</label>
										<div class="col-md-10">
											<script type="text/plain" id="contentDesc" style="width: 100%; height: 500px;">${message.content}</script>
											<script type="text/javascript">
												/*UE.getEditor('editorDesc',{});*/
												var ue = UE.getEditor('contentDesc', {
													//这里可以选择自己需要的工具按钮名称,此处仅选择如下五个
													//focus时自动清空初始化时的内容
													autoClearinitialContent : false,
													//关闭字数统计
													wordCount : false,
													imageUrlPrefix : '<%=PublicConfig.IMG_ROOT_URL%>',
													//默认的编辑区域高度
													initialFrameWidth:1260,
													//默认的编辑区域高度
													initialFrameHeight:500,
													//关闭elementPath
													elementPathEnabled:false
												});
												  
												UE.Editor.prototype._bkGetActionUrl = UE.Editor.prototype.getActionUrl;
												UE.Editor.prototype.getActionUrl = function(action) {
													 if (action == 'uploadimage' || action == 'uploadscrawl' || action == 'uploadimage') {
														 return '<%=basePath%>/product/multiFileUeditorUpload.do';
													 } else {
														 return this._bkGetActionUrl.call(this, action);
													 }
												 } 
											</script>
											<span id="content" name="content" style="display: none;">${message.content }</span>
										</div>
									</div>
								</form>
								<div class="ln_solid"></div>
								<div class="form-btn-content">
									<a id="btn_save" class="btn btn-primary">确定</a> <a id="btn_back" class="btn btn-default">返回</a>
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
</body>
<script type="text/javascript" src="<%=basePath%>/statics/js/jquery.form.js"></script>
<script type="text/javascript" src="<%=basePath%>/statics/js/jquery.validate.js"></script>
<script type="text/javascript" src="<%=basePath%>/statics/js/jquery.metadata.js"></script>
<script type="text/javascript"  src="${rootPath}/statics/plugins/upload/ajaxfileupload.js"></script>
<script type="text/javascript" src="${rootPath}/js/message/message_form.js"></script>
</html>